
const { faceCreateLibrary,faceGetLibrarys,faceDetect,faceAddface,faceFacesetDetail,faceSearch } = require('../face-api/face++Face')

class KSController {
  async createLibrary(ctx, next) {
    const result = await faceCreateLibrary(ctx.request.body)
    ctx.body = result
  }
  async getLibrarys(ctx, next) {
    const result = await faceGetLibrarys()
    ctx.body = result
  }
  async detect(ctx,next) { 
    const data = {
      image_base64: ctx.request.img,
      ...ctx.request.body
    }
    const result = await faceDetect(data)
    ctx.body = result
  }
  async addface(ctx,next) { 
    const result = await faceAddface(ctx.request.body)
    ctx.body = result
  }
  async getFacesetDetail(ctx, next) {
    const result = await faceFacesetDetail(ctx.request.body)
    ctx.body = result
  }
  async search(ctx, next) { 
    const data = {
      image_base64: ctx.request.img,
      ...ctx.request.body
    }
    const result = await faceSearch(data)
    ctx.body = result
  }
}

module.exports = new KSController()